package com.apes.scm.masterdata.contrast.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.party.model.Party;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：当事人角色
 *
 * @author xul
 * @create 2018-01-24 13:37
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = ContrastPartyCode.CONST_TABLE_NAME,indexes = {
        @Index(name = "idx_contrast_party_code", columnList = "PARTY_ID", unique = true),
        @Index(name = "idx_contrast_party_vipId", columnList = "vipid")})
public class ContrastPartyCode extends BaseModel {
    public static final String CONST_TABLE_NAME = "contrast_party_code";

    @Id
    @Column(name = "id",length = 16)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "角色对照表")
    private String id;

    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    @JoinColumn(name = "PARTY_ID", referencedColumnName = "ID")
    private Party party; //当事人

    @Column(name = "gsid",  length = 120)
    private String gsid; //公司编码

    @Column(name = "gysid",  length = 120)
    private String gysid; //供应商编码

    @Column(name = "khid", length = 120)
    private String khid; //客户编码

    @Column(name = "vipid", length = 120)
    private String vipid; //会员编码

    @Column(name = "ryid", length = 120)
    private String ryid; //人员编码

}
